﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
// Testar bara :)

namespace Test
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            switch (ddlObject.SelectedValue)
            {
                case "BO":
                    txtCode.Text = Dry.Generators.BOGenerator.GetBOClass(ddlTables.SelectedValue, false);
                    break;
                case "DAL":
                    txtCode.Text = Dry.Generators.DALGenerator.GetDALClass(ddlTables.SelectedValue);
                    break;
                case "IP":
                    txtCode.Text = Dry.Generators.IPGenerator.GetIPClass(ddlTables.SelectedValue);
                    break;
                case "BLL":
                    throw new Exception("Not implemented");
            }            
        }

        protected void btnGenerateFile_Click(object sender, EventArgs e)
        {
            switch (ddlObject.SelectedValue)
            {
                case "BO":
                    Dry.Generators.BOGenerator.CreateFile(ddlTables.SelectedValue, false);
                    break;
                case "DAL":
                    Dry.Generators.DALGenerator.CreateFile(ddlTables.SelectedValue, "4", false);
                    break;
                case "IP":
                    Dry.Generators.IPGenerator.CreateFile(ddlTables.SelectedValue);
                    break;
                case "BLL":
                    Dry.Generators.BLLGenerator.CreateFile(ddlTables.SelectedValue, false);
                    break;
            }
        }

        protected void btnGenerateBackend_Click(object sender, EventArgs e)
        {
            Dry.Dry.GenerateBackend();
        }
    }
}
